package com.springtest.demo.serices.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Component;

import com.springtest.demo.dao.StudentDao;
import com.springtest.demo.model.ResultEntity;
import com.springtest.demo.model.Student;
import com.springtest.demo.serices.StudentService;

@Component("studentService")
@Transactional
public class StudentServiceImpl implements StudentService{
	
	@Resource(name="studentDao")
	private StudentDao studentDao;
	
	public ResultEntity saveStu(Student stu) {
		return ResultEntity.getInstance().setData(studentDao.saveStu(stu));
		
	}

	public ResultEntity deleteStu(int id) {
		return ResultEntity.getInstance().setData(studentDao.deleteStu(id));
		
	}

	public ResultEntity updateStu(Student stu) {
		return ResultEntity.getInstance().setData(studentDao.updateStu(stu));
		
	}

	public ResultEntity listStuByParam(String param,String value) {
		return ResultEntity.getInstance().setData(studentDao.listStuByParam(param, value));
		
	}

	public ResultEntity listStuById(int id) {
		return ResultEntity.getInstance().setData(studentDao.listStuById(id));
		
	}

	public ResultEntity listStu() {
		return ResultEntity.getInstance().setData(studentDao.listStu());
		
	}

}
